﻿using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;

namespace Mvcmediaplayer.Models
{
    [MetadataType(typeof(VideoMetaData))]
    public partial class Video
    {
        // Validation rules for Video class

        [Bind(Exclude = "Id")]
        public class VideoMetaData
        {
            [ScaffoldColumn(false)]
            public object Id { get; set; }
            
            [Required(ErrorMessage="An Title is required")]
            [StringLength(255)]
            public object Title { get; set; }

            [DisplayName("Video URL")]
            [Required(ErrorMessage="Url is required")]
            [StringLength(255)]
            public object Url { get; set; }

            [DisplayName("Leading Actors")]
            [Required(ErrorMessage="Leading Actors are required")]
            [StringLength(100)]
            public object Actors { get; set; }

            [Required(ErrorMessage="Review information is required")]
            public object Review { get; set; }

            [Required(ErrorMessage="Year is required")]
            [RegularExpression(@"^\d{4}$", ErrorMessage = "Year is not valid")]
            public object Year { get; set; }
        }
    }
}